package com.lmonkey.servlet.my;

import com.lmonkey.servic.ADDRESSDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/shangc/deletedr")
public class DeleteDr extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //设置字符集
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=utf-8");
        //获取参数
        int id = Integer.parseInt(request.getParameter("id"));
        String eids = request.getParameter("ids");
        String flag = request.getParameter("flag");

        //删除地址
        ADDRESSDao.delete(id);

        //跳转
        if (eids != null){
            response.sendRedirect("orderselect?eids="+eids);
        }else if (flag.equals("1")){
            response.sendRedirect("addressselect");
        }

    }
}
